package main.java.indi.zyj.c150.recursion;

public class _07_Power {

    public static void main(String[] args) {
        System.out.println(f(2, 1));
    }



    private static int f(int a, int n){

        if (n == 0){
            return 1;
        }

        int res = a;
        int ex = 1;

        while ((ex<<1) <= n){
            res = res * res;
            ex <<= 1;
        }

        return res * f(a, n - ex);

    }

}
